# -*- coding: utf-8 -*-
# @Author: Cursor
# @Date: 2025-01-08
# @Last Modified by: Tim Liu
# @Last Modified time: 2025-01-08

# @Description: OSchema pydantic
 
from pydantic import BaseModel, ConfigDict
from core.data_types import DatetimeStr
from apps.vadmin.auth.schemas import UserSimpleOut

class OSchema(BaseModel):
    name: str
    description: str | None = None
    
    schema_type: str | None = None
    schema_content: str     # schema content in json
    schema_scope: int = 0       # schema scope (0: global, 1: local)
    
    create_user_id: int | None = None
    version: int = 1
    is_active: bool = True

class OSchemaSimpleOut(OSchema):
    model_config = ConfigDict(from_attributes=True)
    
    id: int
    update_datetime: DatetimeStr
    create_datetime: DatetimeStr

class OSchemaFullOut(OSchemaSimpleOut):
    model_config = ConfigDict(from_attributes=True)
    
    ontologies: list["Ontology"]  # Use forward reference for Ontology 
    create_user: UserSimpleOut

from .ontology import Ontology  # Import Ontology
    